/*
 * Copyright (c) 2006 Intel Corporation
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached INTEL-LICENSE     
 * file. If you do not find these files, copies can be found by writing to
 * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
 * 94704.  Attention:  Intel License Inquiry.
 */

/**
 * 
 * @author David Gay
 * @author Kyle Jamieson
 */

configuration ConstrucaoInteligenteAppC { }
implementation {
	components RF230ActiveMessageC as Radio;
	components MainC, ConstrucaoInteligenteC, LedsC;
	components new TimerMilliC() as Timer0, new TimerMilliC() as Timer1,new TimerMilliC() as Timer2;
	components new PhotoC() as Read0, new TempC() as Read1;

	ConstrucaoInteligenteC.Boot -> MainC;
	ConstrucaoInteligenteC.Timer0 -> Timer0;
	ConstrucaoInteligenteC.Timer1 -> Timer1;
	ConstrucaoInteligenteC.Timer2 -> Timer2;
	ConstrucaoInteligenteC.Read0 -> Read0;
	ConstrucaoInteligenteC.Read1 -> Read1;
  	ConstrucaoInteligenteC.Leds -> LedsC;

  //
  // Communication components.  These are documented in TEP 113:
  // Serial Communication, and TEP 119: Collection.
  //
	components CollectionC as Collector,  // Collection layer
	ActiveMessageC,                         // AM layer
	new CollectionSenderC(AM_CI), // Sends multihop RF
	SerialActiveMessageC,                   // Serial messaging
	new SerialAMSenderC(AM_CI);   // Sends to the serial port

    	//ACK
    	ConstrucaoInteligenteC.ACKControl -> ActiveMessageC;


	ConstrucaoInteligenteC.RadioControl -> ActiveMessageC;
	ConstrucaoInteligenteC.SerialControl -> SerialActiveMessageC;
	ConstrucaoInteligenteC.RoutingControl -> Collector;
	ConstrucaoInteligenteC.LowPowerListening -> Radio;


	ConstrucaoInteligenteC.Send -> CollectionSenderC;
	ConstrucaoInteligenteC.SerialSend -> SerialAMSenderC.AMSend;
	ConstrucaoInteligenteC.Snoop -> Collector.Snoop[AM_CI];
	ConstrucaoInteligenteC.Receive -> Collector.Receive[AM_CI];
	ConstrucaoInteligenteC.RootControl -> Collector;
	ConstrucaoInteligenteC.PacketTransmitPower -> Radio.PacketTransmitPower;

	components new PoolC(message_t, 10) as UARTMessagePoolP,
	new QueueC(message_t*, 10) as UARTQueueP;

	ConstrucaoInteligenteC.UARTMessagePool -> UARTMessagePoolP;
	ConstrucaoInteligenteC.UARTQueue -> UARTQueueP;
  
	components new PoolC(message_t, 20) as DebugMessagePool,
	new QueueC(message_t*, 20) as DebugSendQueue,
	new SerialAMSenderC(AM_CTP_DEBUG) as DebugSerialSender,
	UARTDebugSenderP as DebugSender;

	DebugSender.Boot -> MainC;
	DebugSender.UARTSend -> DebugSerialSender;
	DebugSender.MessagePool -> DebugMessagePool;
	DebugSender.SendQueue -> DebugSendQueue;
	Collector.CollectionDebug -> DebugSender;

}
